<template>
    <div class="tab-container">
        <el-dialog :visible.sync="dialogVisible" width="500px" @close="close">
            <!-- <span slot="title" class="dialog-header">
              
            </span> -->
            <div class="dialog-header">
                <span>本专栏为收费专栏，请付费购买后再查看。</span>
                <span>你也可以单独购买本章节内容</span>
            </div>
            <el-form label-width="7.81vw">
                <el-form-item label="价格:">
                    <div class="copy">
                        <span>{{ info.price }}</span>
                    </div>
                </el-form-item>
                <div class="select">

                    <el-form-item label="二维码:">
                        <img :src="info.img" alt="">
                    </el-form-item>
                </div>
                <!-- <el-form-item label="支付方式">
                    <el-radio v-model="pay" :label="1">微信支付</el-radio>
                    <el-radio v-model="pay" :label="2">余额支付</el-radio>
                </el-form-item> -->
            </el-form>
            <!-- <span slot="footer" class="dialog-footer">
                <el-button @click="dialogVisible = false">取 消</el-button>
                <el-button type="primary">确 定</el-button>
            </span> -->
        </el-dialog>
    </div>
</template>

<script>
export default {
    name: 'buyDia',
    props: {
        info: {
            type: Object,
            default: () => {
                return {}
            },
        },

    },

    data() {
        return {
            dialogVisible: false
        };
    },
    computed: {
        // 计算滑块的样式
        sliderStyle() {
            const tabWidth = 100 / this.tabs.length; // 每个 Tab 的宽度百分比
            return {
                width: `${tabWidth}%`, // 滑块的宽度
                transform: `translateX(${this.activeTab * 100}%)`, // 滑块的偏移量
            };
        },
    },
    methods: {
        async copyLink(link) {
            try {
                await navigator.clipboard.writeText(link)
                this.$message.success('链接已复制') // 使用Element UI的消息提示
                // 或者 alert('链接已复制')
            } catch (err) {
                console.error('复制失败:', err)
                this.$message.error('复制失败')
            }
        },
        // 切换 Tab
        open() {
            this.dialogVisible = true
        },
        close() {
            this.dialogVisible = false
            this.$emit('onstop')

        },
    },
};
</script>

<style scoped lang="scss">
.dialog-header {
    font-weight: bold;
    padding: 0 50px;

    span {
        display: block;
        font-size: 18px;
        color: #409EFF;
        text-align: center;
    }
}

.dialog-footer {
    font-weight: bold;
    font-size: 22px;
    display: flex;
    justify-content: center;
    align-items: center;

    button {
        margin: 0 50px;
        width: 140px;
        height: 50px;
        font-size: 16px;
        line-height: 50px;
        padding: 0;
    }
}

.copy {
    display: flex;
    align-items: center;

    span {
        margin-right: 20px;
        font-size: 22px;
        color: #ff5640;
    }
}

.select {
    img {
        max-width: 200px;
        max-height: 200px;
    }
}

.title {
    text-align: center;
    font-weight: bold;
    font-size: 25px;
    color: #000;
    margin-bottom: 50px;
}
</style>